'use strict';

const Controller = require('egg').Controller;

/**
 * @controller 任务优先级 task_priority
 */

class TaskPrioritysController extends Controller {
  /**
   * @apikey
   * @summary 获取 任务优先级
   * @description 获取 任务优先级
   * @request query string name task_priority名
   * @request query number limit limit
   * @request query number offset offset
   * @router get /api/v1/task_prioritys/list
   */
  async findAll() {
    const { ctx, service } = this;
    const { allRule, query } = ctx.helper.tools.findAllParamsDeal({
      rule: ctx.rule.task_priorityPutBodyReq,
      queryOrigin: ctx.query,
    });
    ctx.validate(allRule, query);
    const res = await service.taskPrioritys.findAll(query);
    ctx.helper.body.SUCCESS({ ctx, res });
  }
}

module.exports = TaskPrioritysController;